home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / doc / usr_09.txt < prev    next >
Encoding:
Text File  |  2001-09-26  |  11.2 KB  |  290 lines

  1. *usr_09.txt*    For Vim version 6.0.  Last change: 2001 Sep 03
  2.  
  3.              VIM USER MANUAL - by Bram Moolenaar
  4.  
  5.                 Using the GUI
  6.  
  7.  
  8. Vim works in an ordinary terminal.  GVim can do the same things and a few
  9. more.  The GUI offers menus, a toolbar, scrollbars and other items.  This
  10. chapter is about these extra things that the GUI offers.
  11.  
  12. |09.1|    Parts of the GUI
  13. |09.2|    Using the mouse
  14. |09.3|    The clipboard
  15. |09.4|    Select mode
  16.  
  17.      Next chapter: |usr_10.txt|  Making big changes
  18.  Previous chapter: |usr_08.txt|  Splitting windows
  19. Table of contents: |usr_toc.txt|
  20.  
  21. ==============================================================================
  22. *09.1*    Parts of the GUI
  23.  
  24. You might have an icon on your desktop that starts gVim.  Otherwise, one of
  25. these commands should do it: >
  26.  
  27.     gvim file.txt
  28.     vim -g file.txt
  29.  
  30. If this doesn't work you don't have a version of Vim with GUI support.  You
  31. will have to install one first.
  32.    Vim will open a window and display "file.txt" in it.  What the window looks
  33. like depends on the version of Vim.  It should resemble the following picture
  34. (for as far as this can be shown in ASCII!).
  35.  
  36.     +----------------------------------------------------+
  37.     | file.txt + (~/dir) - VIM               X |    <- window title
  38.     +----------------------------------------------------+
  39.     | File    Edit  Tools  Syntax  Buffers  Window  Help   |    <- menubar
  40.     +----------------------------------------------------+
  41.     | aaa  bbb  ccc  ddd  eee  fff    ggg  hhh  iii  jjj   |    <- toolbar
  42.     | aaa  bbb  ccc  ddd  eee  fff    ggg  hhh  iii  jjj   |
  43.     +----------------------------------------------------+
  44.     | file text                     | ^ |
  45.     | ~                         | # |
  46.     | ~                         | # |    <- scrollbar
  47.     | ~                         | # |
  48.     | ~                         | # |
  49.     | ~                         | # |
  50.     |                         | V |
  51.     +----------------------------------------------------+
  52.  
  53. The largest space is occupied by the file text.  This shows the file in the
  54. same way as in a terminal.  With some different colors and another font
  55. perhaps.
  56.  
  57.  
  58. THE WINDOW TITLE
  59.  
  60. At the very top is the window title.  This is drawn by your window system.
  61. Vim will set the title to show the name of the current file.  First comes the
  62. name of the file.  Then some special characters and the directory of the file
  63. in parens.  These special character can be present:
  64.  
  65.     -    The file cannot be modified (e.g., a help file)
  66.     +    The file contains changes
  67.     =    The file is read-only
  68.     =+    The file is read-only, contains changes anyway
  69.  
  70. If nothing is shown you have an ordinary, unchanged file.
  71.  
  72.  
  73. THE MENUBAR
  74.  
  75. You know how menus work, right?  Vim has the usual items, plus a few more.
  76. Browse them to get an idea of what you can use them for.  A relevant submenu
  77. is Edit/Global Settings.  You will find these entries:
  78.  
  79.     Toggle Toolbar        make the toolbar appear/disappear
  80.     Toggle Bottom Scrollbar    make a scrollbar appear/disappear at the bottom
  81.     Toggle Left Scrollbar    make a scrollbar appear/disappear at the left
  82.     Toggle Right Scrollbar    make a scrollbar appear/disappear at the right
  83.  
  84. On most systems you can tear-off the menus.  Select the top item of the menu,
  85. the one that looks like a dashed line.  You will get a separate window with
  86. the items of the menu.  It will hang around until you close the window.
  87.  
  88.  
  89. THE TOOLBAR
  90.  
  91. This contains icons for the most often used actions.  Hopefully the icons are
  92. self-explanatory.  There are tooltips to get an extra hint (move the mouse
  93. pointer to the icon without clicking and don't move it for a second).
  94.  
  95. The "Edit/Global Settings/Toggle Toolbar" menu item can be used to make the
  96. toolbar disappear.  If you never want a toolbar, use this command in your
  97. vimrc file: >
  98.  
  99.     :set guioptions-=T
  100.  
  101. This removes the 'T' flag from the 'guioptions' option.  Other parts of the
  102. GUI can also be enabled or disabled with this option.  See the help for it.
  103.  
  104.  
  105. THE SCROLLBARS
  106.  
  107. By default there is one scrollbar on the right.  It does the obvious thing.
  108. When you split the window, each window will get its own scrollbar.
  109.    You can make a horizontal scrollbar appear with the menu item
  110. Edit/Global Settings/Toggle Bottom Scrollbar.  This is useful in diff mode, or
  111. when the 'wrap' option has been reset (more about that later).
  112.  
  113. When there are vertically split windows, only the windows on the right side
  114. will have a scrollbar.  However, when you move the cursor to a window on the
  115. left, it will be this one the that scrollbar controls.  This takes a bit of
  116. time to get used to.
  117.    When you work with vertically split windows, consider adding a scrollbar on
  118. the left.  This can be done with a menu item, or with the 'guioptions' option:
  119. >
  120.     :set guioptions+=l
  121.  
  122. This adds the 'l' flag to 'guioptions'.
  123.  
  124. ==============================================================================
  125. *09.2*    Using the mouse
  126.  
  127. Standards are wonderful.  In Microsoft Windows, you can use the mouse to
  128. select text in a standard manner.  The X Window system also has a standard
  129. system for using the mouse.  Unfortunately, these two standards are not the
  130. same.
  131.    Fortunately, you can customize Vim.  You can make the behavior of the mouse
  132. work like an X Window system mouse or a Microsoft Windows mouse. The following
  133. command makes the mouse behave like an X Window mouse: >
  134.  
  135.     :behave xterm
  136.  
  137. The following command makes the mouse work like a Microsoft Windows mouse: >
  138.  
  139.     :behave mswin
  140.  
  141. The default behavior of the mouse on UNIX systems is xterm.  The default
  142. behavior on a Microsoft Windows system is selected during the installation
  143. process.  For details about what the two behaviors are, see |:behave|.  Here
  144. follows a summary.
  145.  
  146.  
  147. XTERM MOUSE BEHAVIOR
  148.  
  149. Left mouse click        position the cursor
  150. Left mouse drag            select text in Visual mode
  151. Middle mouse click        paste text from the clipboard
  152. Right mouse click        extend the selected text until the mouse
  153.                 pointer
  154.  
  155.  
  156. MSWIN MOUSE BEHAVIOR
  157.  
  158. Left mouse click        position the cursor
  159. Left mouse drag            select text in Select mode (see |09.4|)
  160. Left mouse click, with Shift    extend the selected text until the mouse
  161.                 pointer
  162. Middle mouse click        paste text from the clipboard
  163. Right mouse click        display a pop-up menu
  164.  
  165.  
  166. The mouse can be further tuned.  Check out these options if you want to change
  167. the way how the mouse works:
  168.  
  169.     'mouse'            in which mode the mouse is used by Vim
  170.     'mousemodel'        what effect a mouse click has
  171.     'mousetime'        time between clicks for a double-click
  172.     'mousehide'        hide the mouse while typing
  173.     'selectmode'        whether the mouse starts Visual or Select mode
  174.  
  175. ==============================================================================
  176. *09.3*    The clipboard
  177.  
  178. In section |04.7| the basic use of the clipboard was explained.  There is one
  179. essential thing to explain about X-windows: There are actually two places to
  180. exchange text between programs.  MS-Windows doesn't have this.
  181.  
  182. In X-Windows there is the "current selection".  This is the text that is
  183. currently highlighted.  In Vim this is the Visual area (this assumes you are
  184. using the default option settings).  You can paste this selection in another
  185. application without any further action.
  186.    For example, in this text select a few words with the mouse.  Vim will
  187. switch to Visual mode and highlight the text.  Now start another gVim, without
  188. a file name argument, so that it displays an empty window.  Click the middle
  189. mouse button.  The selected text will be inserted.
  190.  
  191. The "current selection" will only remain valid until some other text is
  192. selected.  After doing the paste in the other gVim, now select some characters
  193. in that window.  You will notice that the words that were previously selected
  194. in the other gVim window are displayed differently.  This means that it no
  195. longer is the current selection.
  196.  
  197. You don't need to select text with the mouse, using the keyboard commands for
  198. Visual mode works just as well.
  199.  
  200.  
  201. THE REAL CLIPBOARD
  202.  
  203. Now for the other place with which text can be exchanged.  We call this the
  204. "real clipboard", to avoid confusion.  Often both the "current selection" and
  205. the "real clipboard" are called clipboard, you'll have to get used to that.
  206.    To put text on the real clipboard, select a few different words in one of
  207. the gVims you have running.  Then use the Edit/Copy menu entry.  Now the text
  208. has been copied to the real clipboard.  You can't see this, unless you have
  209. some application that shows the clipboard contents (e.g., KDE's klipper).
  210.    Now select the other gVim, position the cursor somewhere and use the
  211. Edit/Paste menu.  You will see the text from the real clipboard is inserted.
  212.  
  213.  
  214. USING BOTH
  215.  
  216. This use of both the "current selection" and the "real clipboard" might sound
  217. a bit confusing.  But it is very useful.  Let's show this with an example.
  218. Use one gVim with a text file and perform these actions:
  219.  
  220. -  Select two words in Visual mode.
  221. -  Use the Edit/Copy menu to get these words onto the clipboard.
  222. -  Select one other word in Visual mode.
  223. -  Use the Edit/Paste menu item.  What will happen is that the single selected
  224.    word is replaced with the two words from the clipboard.
  225. -  Move the mouse pointer somewhere else and click the middle button.  You
  226.    will see that the word you just overwrote with the clipboard is inserted
  227.    here.
  228.  
  229. If you use the "current selection" and the "real clipboard" with care, you can
  230. do a lot of useful editing with them.
  231.  
  232.  
  233. USING THE KEYBOARD
  234.  
  235. If you don't like using the mouse, you can access the current selection and
  236. the real clipboard with two registers.  The "* register is for the current
  237. selection.
  238.    To make text become the current selection, use Visual mode.  For example,
  239. to select a whole line just press "V".
  240.    To insert the current selection before the cursor: >
  241.  
  242.     "*P
  243.  
  244. Notice the uppercase "P".  The lowercase "p" puts the text after the cursor.
  245.  
  246. The "+ register is used for the real clipboard.  For example, to copy the text
  247. from the cursor position until the end of the line to the clipboard: >
  248.  
  249.     "+y$
  250.  
  251. Remember, "y" is yank, which is Vim's copy command.
  252.    To insert the contents of the real clipboard before the cursor: >
  253.  
  254.     "+P
  255.  
  256. It's the same as for the current selection, but uses the plus (+) register
  257. instead of the star (*) register.
  258.  
  259. ==============================================================================
  260. *09.4*    Select mode
  261.  
  262. And now something that is used more often on MS-Windows than on X-Windows.
  263. But both can do it.  You already know about Visual mode.  Select mode is like
  264. Visual mode, because it is also used to select text.  But there is an obvious
  265. difference: When typing text, the selected text is deleted and the typed text
  266. replaces it.
  267.  
  268. To start working with Select mode, you must first enable it (for MS-Windows
  269. it is probably already enabled, but you can do this anyway): >
  270.  
  271.     :set selectmode+=mouse
  272.  
  273. Now use the mouse to select some text.  It is highlighted like in Visual mode.
  274. Now press a letter.  The selected text is deleted, and the single letter
  275. replaces it.  You are in Insert mode now, thus you can continue typing.
  276.  
  277. Since typing normal text causes the selected text to be deleted, you can not
  278. use the normal movement commands "hjkl", "w", etc.  Instead, use the shifted
  279. function keys.  <S-Left> (shifted cursor left key) moves the cursor left.  The
  280. selected text is changed like in Visual mode.  The other shifted cursor keys
  281. do what you expect.  <S-End> and <S-Home> also work.
  282.  
  283. You can tune the way Select mode works with the 'selectmode' option.
  284.  
  285. ==============================================================================
  286.  
  287. Next chapter: |usr_10.txt|  Making big changes
  288.  
  289. Copyright: see |manual-copyright|  vim:tw=78:ts=8:ft=help:norl:
  290.